<template>
  <!-- 申请人信息 -->
  <div class="bg-white my-[10px]">
    <BaseHead style="border-bottom: 0">申请人信息</BaseHead>
    <BaseTable>
      <tr>
        <td class="td-name">申请人</td>
        <td>{{ props.detailData.applierName }}</td>
        <td class="td-name">性别</td>
        <td><CommonLabel :dataList="sexList" :value="props.detailData.sex" /></td>
      </tr>
      <tr>
        <td class="td-name">出生年月</td>
        <td><DateLabel :value="props.detailData.birthday" format="YYYY-MM" /></td>
        <td class="td-name">行政职务</td>
        <td>
          <CommonLabel :dataList="executivePostList" :value="props.detailData.executivePost" />
        </td>
      </tr>
      <tr>
        <td class="td-name">申请人学位</td>
        <td>
          <CommonLabel
            :dataList="applierEduDegreeList"
            :value="props.detailData.applierEduDegreeId"
          />
        </td>
        <td class="td-name">申请人职称</td>
        <td>
          <CommonTreeLabel :dataList="applierTitleList" :value="props.detailData.applierTitleId" />
        </td>
      </tr>
      <tr>
        <td class="td-name">所在研究基地类型</td>
        <td>
          <CommonLabel
            :dataList="researchBaseTypeList"
            :value="props.detailData.researchBaseType"
          />
        </td>
        <td class="td-name">所在研究基地名称</td>
        <td>{{ props.detailData.researchBase }}</td>
      </tr>
    </BaseTable>
  </div>
  <!-- 项目信息 -->
  <div class="bg-white">
    <BaseHead style="border-bottom: 0">项目信息</BaseHead>
    <BaseTable>
      <tr>
        <td class="td-name">项目名称</td>
        <td>{{ props.detailData.name }}</td>
        <td class="td-name">项目编号</td>
        <td>{{ props.detailData.projectCode }}</td>
      </tr>
      <tr>
        <td class="td-name">申请经费</td>
        <td>{{ props.detailData.applyFee }} 万元</td>
        <td class="td-name">项目分类</td>
        <td>
          <CommonTreeLabel
            :dataList="projectTypeList"
            :value="props.detailData.projectTypeId"
            labelKey="labelLocal"
          />
        </td>
      </tr>
      <tr>
        <td class="td-name">国民行业</td>
        <td>
          <CommonTreeLabel
            :dataList="nationalIndustryList"
            :value="props.detailData.nationalIndustryCode"
          />
        </td>
        <td class="td-name">科技活动类型</td>
        <td>
          <CommonLabel
            :dataList="technologyActivityList"
            :value="props.detailData.technologyActivityType"
          />
        </td>
      </tr>
      <tr>
        <td class="td-name">研究开始日期</td>
        <td><DateLabel :value="props.detailData.planStartDate" format="YYYY-MM" /></td>
        <td class="td-name">研究结束日期</td>
        <td><DateLabel :value="props.detailData.planEndDate" format="YYYY-MM" /></td>
      </tr>
      <tr>
        <td class="td-name">一级学科</td>
        <td>
          <CommonLabel
            :dataList="subjectList"
            labelKey="label"
            valueKey="id"
            :value="props.detailData.subjectId"
          />
        </td>
        <td class="td-name">所属单位</td>
        <td>
          <CommonTreeLabel
            :dataList="unitList"
            valueKey="codeColumn"
            labelKey="valueColumn"
            :value="props.detailData.unitId"
          />
        </td>
      </tr>
      <tr>
        <td class="td-name">项目摘要</td>
        <td colspan="3">{{ props.detailData.projectSummary }}</td>
      </tr>
      <tr>
        <td class="td-name">关键词</td>
        <td colspan="3">{{ props.detailData.keyword }}</td>
      </tr>
      <tr>
        <td class="td-name">申报书</td>
        <td colspan="3">
          <template v-if="props.detailData.fileInfo">
            <p v-for="item in props.detailData.fileInfo" :key="item.id" class="my-[5px]">
              {{ item.fileName }}
              <el-link
                type="primary"
                @click="handleDownload(item.id, item.fileName)"
                class="ml-[5px]"
                >下载</el-link
              >
            </p>
          </template>
        </td>
      </tr>
      <tr>
        <td class="td-name">备注</td>
        <td colspan="3">{{ props.detailData.note }}</td>
      </tr>
    </BaseTable>
  </div>
</template>

<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import BaseTable from "@/views/project/components/BaseTable.vue";
import CommonLabel from "@/views/project/components/CommonLabel.vue";
import CommonTreeLabel from "@/views/project/components/CommonTreeLabel.vue";
import DateLabel from "@/views/project/components/DateLabel.vue";
import { handleDownload } from "@/utils/main";
const sexList = inject("sexList");
const executivePostList = inject("executivePostList");
const applierEduDegreeList = inject("applierEduDegreeList");
const applierTitleList = inject("applierTitleList");
const researchBaseTypeList = inject("researchBaseTypeList");
const projectTypeList = inject("projectTypeList");
const nationalIndustryList = inject("nationalIndustryList");
const technologyActivityList = inject("technologyActivityList");
const subjectList = inject("subjectList");
const unitList = inject("unitList");
const props = defineProps({
  detailData: {
    type: Object,
    default: () => ({}),
  },
});
</script>

<style scoped lang="scss"></style>
